﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Criterion;
using Rodunu.Movies.Data;
using Rodunu.Movies.Interfaces.Collections;

namespace Rodunu.Movies.Logic.Collections
{
    public class UserCollectionsLogic : Repository<Contracts.UserCollections>, IUserCollections
    {
        public IList GetUserCollectionsByUser(long userId)
        {
            ISession session = DBHelper.GetCurrentSession();
            IList collections = session.CreateCriteria(typeof(Contracts.UserCollections))
                                                     .Add(Expression.Eq("UserInfo.Id", userId))
                                                     .List();
            //DBHelper.CloseSession();
            return collections;
        }
    }
}
